package com.whm.hrmanagement.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson2.JSONObject;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.whm.common.annotation.Log;
import com.whm.common.core.controller.BaseController;
import com.whm.common.core.domain.AjaxResult;
import com.whm.common.enums.BusinessType;
import com.whm.hrmanagement.domain.OaQpglqpms;
import com.whm.hrmanagement.service.IOaQpglqpmsService;
import com.whm.common.utils.poi.ExcelUtil;
import com.whm.common.core.page.TableDataInfo;

/**
 * hrmanagementController
 * 
 * @author whm
 * @date 2024-02-04
 */
@RestController
@RequestMapping("/hrmanagement/qpglqpms")
public class OaQpglqpmsController extends BaseController
{
    @Autowired
    private IOaQpglqpmsService oaQpglqpmsService;

    /**
     * 查询hrmanagement列表
     */
    @PreAuthorize("@ss.hasPermi('hrmanagement:qpglqpms:list')")
    @GetMapping("/list")
    public TableDataInfo list(OaQpglqpms oaQpglqpms)
    {
        startPage();
        List<OaQpglqpms> list = oaQpglqpmsService.selectOaQpglqpmsList(oaQpglqpms);
        return getDataTable(list);
    }

    /**
     * 导出hrmanagement列表
     */
    @PreAuthorize("@ss.hasPermi('hrmanagement:qpglqpms:export')")
    @Log(title = "hrmanagement", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OaQpglqpms oaQpglqpms)
    {
        List<OaQpglqpms> list = oaQpglqpmsService.selectOaQpglqpmsList(oaQpglqpms);
        ExcelUtil<OaQpglqpms> util = new ExcelUtil<OaQpglqpms>(OaQpglqpms.class);
        util.exportExcel(response, list, "hrmanagement数据");
    }

    /**
     * 获取hrmanagement详细信息
     */
    @PreAuthorize("@ss.hasPermi('hrmanagement:qpglqpms:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(oaQpglqpmsService.selectOaQpglqpmsById(id));
    }

    /**
     * 新增hrmanagement
     */
    @PreAuthorize("@ss.hasPermi('hrmanagement:qpglqpms:add')")
    @Log(title = "hrmanagement", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JSONObject data)
    {
        return toAjax(oaQpglqpmsService.insertOaQpglqpms(data));
    }

    /**
     * 修改hrmanagement
     */
    @PreAuthorize("@ss.hasPermi('hrmanagement:qpglqpms:edit')")
    @Log(title = "hrmanagement", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JSONObject data)
    {
        return toAjax(oaQpglqpmsService.updateOaQpglqpms(data));
    }

    /**
     * 删除hrmanagement
     */
    @PreAuthorize("@ss.hasPermi('hrmanagement:qpglqpms:remove')")
    @Log(title = "hrmanagement", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(oaQpglqpmsService.deleteOaQpglqpmsByIds(ids));
    }
}
